package test;

public class TicketPurchase {
    public static void main(String[] args) {
        // 定义4个销售点
        SalesPoint salesPoint1 = new SalesPoint("销售点1");
        SalesPoint salesPoint2 = new SalesPoint("销售点2");
        SalesPoint salesPoint3 = new SalesPoint("销售点3");
        SalesPoint salesPoint4 = new SalesPoint("销售点4");

        // 创建4个线程，分别处理4个销售点的购票操作
        Thread thread1 = new Thread(salesPoint1);
        Thread thread2 = new Thread(salesPoint2);
        Thread thread3 = new Thread(salesPoint3);
        Thread thread4 = new Thread(salesPoint4);

        // 启动4个线程
        thread1.start();
        thread2.start();
        thread3.start();
        thread4.start();
    }
}

// 定义销售点类
class SalesPoint implements Runnable {
    private String name; // 销售点名称

    public SalesPoint(String name) {
        this.name = name;
    }

    // 重写 run() 方法，实现购票操作
    public void run() {
        // 执行购票操作
        System.out.println(name + "正在进行购票操作");
    }
}